package com.gec.hawaste.mapper;

import com.gec.hawaste.entity.Transfer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gec.hawaste.entity.TransferDo;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author gec
 * @since 2022-11-22
 */
public interface TransferMapper extends BaseMapper<Transfer> {

    /**
     * 根据工单id查询转运记录列表
     * @param oid
     * @return
     */
    @Select("SELECT \n" +
            "\ttr.*,\n" +
            "\tsu.NAME user_name,\n" +
            "\tsu.phone user_phone \n" +
            "FROM \n" +
            "\ttransfer tr,\n" +
            "\tsys_user su \n" +
            "WHERE \n" +
            "\ttr.work_order_id = #{oid} \n" +
            "\tAND tr.oprate_user_id = su.id \n" +
            "ORDER BY \n" +
            "\ttr.create_date DESC")
    List<TransferDo> selectByOrderId(Serializable oid);
}
